{extend name="property/public/insidePageBase" /}
{block name="title"}编辑设备信息{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-form layui-form-pane">
            <div class="layui-row">
                <div class="layui-col-xs6">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">物业筛选</label>
                        <div class="layui-input-block">
                            <select name="property_id" lay-filter="property_id" disabled>
                                <option value="">-请选择-</option>
                                {foreach $propertyData as $k=>$v}
                                <option value="{$v['id']}" {:isset($info['property_id']) ? $info['property_id'] == $v['id'] ? 'selected' : '' : ''}>{$v['name']}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">收费方案</label>
                        <div class="layui-input-block" >
                            <select name="plan_id" lay-filter="plan_id">
                                <option value="">请选择</option>
                                {foreach $planData as $k=>$v}
                                <option value="{$v['id']}" {:isset($info['plan_id']) ? $info['plan_id'] == $v['id'] ? 'selected' : '' : ''}>{$v['plan_name']}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-row">
                <div class="layui-col-xs6">
                    <div class="layui-form-item" pane="">
                        <label class="layui-form-label indispensable">表计类型</label>
                        <div class="layui-input-block">
                            <input type="radio" name="wit_type" lay-filter="wit-type" autocomplete="off" value="1" title="智能表" {:isset($info['wit_type']) ? $info['wit_type'] == 1 ? 'checked' : '' : ''}>
                            <input type="radio" name="wit_type" lay-filter="wit-type" autocomplete="off" value="2" title="普通表" {:isset($info['wit_type']) ? $info['wit_type'] == 2 ? 'checked' : '' : ''}>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">缴费类型</label>
                        <div class="layui-input-block">
                            <select name="plan_type" lay-filter="plan_type" disabled>
                                <option value="">--请选择--</option>
                                <option value="1" {:isset($info['plan_type']) ? $info['plan_type'] == 1 ? 'selected' : '' : ''}>后付费【先用后付费】</option>
                                <option value="2" {:isset($info['plan_type']) ? $info['plan_type'] == 2 ? 'selected' : '' : ''}>系统预付费【先存后使用】4G/NB表</option>
                                <option value="3" {:isset($info['plan_type']) ? $info['plan_type'] == 3 ? 'selected' : '' : ''}>离线预付费【先存后使用】蓝牙表</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">设备类型</label>
                        <div class="layui-input-block">
                            <select name="energy_type" lay-filter="energy_type">
                                <option value="">--请选择--</option>
                                {foreach $energyTypeData as $k=>$v}
                                <option value="{$k}" {:isset($info['energy_type']) ? $info['energy_type'] == $k ? 'selected' : '' : ''}>{$v}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs5">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">设备编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="energy_no" value="{$info['energy_no']}" lay-verify="require" autocomplete="off" placeholder="请输入设备编号" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="layui-form-item">
                        <div class="layui-input-group">
                            <div class="layui-input-split layui-input-prefix indispensable">&nbsp;&nbsp;&nbsp;&nbsp;计量倍率</div>
                            <input type="text" name="beilv" value="{$info['beilv']??'1'}" autocomplete="off" class="layui-input" placeholder="请输入计量倍率"  oninput="value=value.replace(/[^\d]/g,'');">
                            <div class="layui-input-split layui-input-suffix"> 倍</div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-row">
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">安装属性</label>
                        <div class="layui-input-block">
                            <select name="is_public" lay-filter="is_public" lay-search>
                                <option value="">--请选择--</option>
                                <option value="1" {:isset($info['is_public']) ? $info['is_public'] == 1 ? 'selected' : '' : ''}>公共设备</option>
                                <option value="2" {:isset($info['is_public']) ? $info['is_public'] == 2 ? 'selected' : '' : ''}>分支设备</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs8">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">安装地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="energy_name" value="{$info['energy_name']}" lay-verify="require" autocomplete="off" placeholder="请输入设备安装地址" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">固定计量价</label>
                        <div class="layui-input-block">
                            <input type="text" name="unit_price" value="{$info['unit_price']??''}"  lay-verify="require" autocomplete="off" placeholder="请输入设备计量单价" class="layui-input" oninput="value=value.replace(/[^\d.]/g,'');">
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs5">
                    <div class="layui-form-item" pane="">
                        <label class="layui-form-label">通断方式
                            <i class="layui-icon layui-icon-question hoverTips"  lay-text="
                                    不设置表示实时通断。例：设置 9，表示每天9点检测一次，符合断开条件: 设备余额小于0、账单逾期支付">
                            </i>
                        </label>
                        <div class="layui-input-block">
                            <input type="radio" name="off_type" lay-filter="off_type" value="1" title="手动" {:isset($info['off_type']) ? $info['off_type'] == 1 ? 'checked' : '' : ''}>
                            <input type="radio" name="off_type" lay-filter="off_type" value="2" title="自动" {:isset($info['off_type']) ? $info['off_type'] == 2 ? 'checked' : '' : ''}>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs3" id="off_box" {if $info['off_type'] != 2}style="display: none"{/if}>
                    <div class="layui-input-group">
                        <select name="off_time" lay-search>
                            <option value="">--请选择--</option>
                            {for start="0" end="24"}
                            <option value="{$i}" {if $i == 8}selected{/if}>{$i}:00</option>
                            {/for}
                        </select>
                        <div class="layui-input-split layui-input-suffix">断电</div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注说明</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入备注说明" class="layui-textarea" name="remark">{$info['remark']}</textarea>
                </div>
            </div>
            <div class="layui-form-item layui-hide">
                <button class="layui-btn" lay-submit lay-filter="submitBtn" id="submitBtn">提交</button>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
{__block__}
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form,layer = layui.layer,  $ = layui.$;
        form.on('radio(off_type)', function(elem) {
            if(elem.value == 2) {
                $('#off_box').show()
            } else {
                $('#off_box').hide()
            }
        })
    });
</script>
{/block}